$(function(){
	$('.startusing').on('click', function() {
		popup(this, "{:url('state')}");

	});
	//禁用
	$('.forbidden').on('click', function() {
		popup(this, "{:url('state')}");

	});
	$('.delete-list').on('click',function(){
		popup(this,"{:url('delete')}");
	});
	$('.sort').click(function(){
		$(this).css('display','none')
		$('.save').css('display','block')
		console.log()
		$('.sortable').sortable({
			 cursor: "move" ,
			 change: function( event, ui ) {
			 	ui.item.prop('id',ui.item.data('id'));
			 }
		});
		
		$( ".sortable" ).sortable( "enable" )
	});
	$('.save').click(function(){
		
		$(this).css('display','none');
		$('.sort').css('display','block');
 		var menusort=[]
		for(var sortedid=0;sortedid<$( ".sortable" ).find('tr').length;sortedid++){
			menusort.push($( ".sortable" ).find('tr').eq(sortedid).data('id'))
		}
		console.log(menusort)
		$.ajax({
			type:"post",
			url:"",
			data:{
				sort:menusort
			},
			success:function(res){
				console.log(res)
			}
		});
		
		$('.sortable').sortable( "disable" );
	});

})
